package com.gxa.community.sso.repository;

import com.gxa.community.sso.entity.login.LoginVo;
import com.gxa.community.sso.entity.UserInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

public interface UserRepository extends CrudRepository<UserInfo,Integer> {
    /**
     * 根据手机号做一键登录
     * @param phone
     * @return
     */
    UserInfo queryUserinfoByPhone(String phone);

    /**
     * 查询团长信息
     * @param userId
     * @return
     */
    @Query("select new com.gxa.community.sso.entity.login.LoginVo(u,a) " +
            "from UserInfo u,UserAgentApplication a " +
            "where u.userId = a.userId and u.userId  = :userId ")
    LoginVo queryUserInfoByType(@Param("userId") Integer userId);
}
